#ifndef CALENDAR_PERIOD_HH
#define CALENDAR_PERIOD_HH

#include <boost/date_time/posix_time/posix_time.hpp>

//Create a simple period class to contain all the times in a day

class calendar_period : public boost::posix_time::time_period
{
   public:
		
	calendar_period(boost::gregorian::date d) : boost::posix_time::time_period(boost::posix_time::ptime(d),//midnight
		   boost::posix_time::ptime(d,boost::posix_time::hours(24)))
      	{}
				
	static bool isLeap(int year);

		// Returns the day of the week for the given date, assumed valid and
  		// in the Gregorian calendar.  The returned value is: 0 for Sunday,
  		// 1 for Monday, ..., 6 for Saturday; or, if the preprocessor symbol
  		// MONDAY_IS_0 is defined: 0 for Monday, 1 for Tuesday, ..., 6 for
  		// Sunday.

	static int weekDay(int day, int month, int year);

	static const std::string week_day_as_string(int day, int month, int year);
	
	static long greg2jul(int day, int month, int year);		
	static void jul2greg(long jul, int& day, int& month, int& year);		

	static long french2jul(int fd, int fm, int fy);		
	static void jul2french(long jd, int& fd, int& fm, int& fy);
		
	static long week(int day, int month, int year);

private: 		
	static const long gregorianStart;
	static const long gregorianEpoch;
	static const int nMonths;
	static const long   frenchEpoch;
	static const double daysPerFrenchYear;
	static int monthDays[];
};


#endif

